package com.awspaas.user.apps.cpq.event;


import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeoutException;

import org.apache.commons.httpclient.URI;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.*;
import com.rabbitmq.client.AMQP.Queue.DeclareOk;


public class Test11 {
	 private final static String QUEUE_NAME = "test_queue";
	public static void main(String[] args) throws IOException, TimeoutException, InterruptedException {
		   // 1. 创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");
         factory.setUsername("guest");
        factory.setPassword("guest");
        try (Connection connection = factory.newConnection();
                Channel channel = connection.createChannel()) {
               channel.queueDeclare(QUEUE_NAME, true, false, false, null);                                             
               // 发送10条测试消息
               for (int i = 0; i < 1; i++) {
         
            	   String message = "Message-" + i;
                   channel.basicPublish("", QUEUE_NAME, 
                       MessageProperties.PERSISTENT_TEXT_PLAIN,
                       message.getBytes());
                   System.out.println(" [x] Sent '" + message + "'");
               }  
               
              DeclareOk que= channel.queueDeclarePassive(QUEUE_NAME);
              int ii=que.getMessageCount();
            String ww=  que.getQueue();
           }
        
        Thread.sleep(5000);



        
       }
   }
